<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择器</title>
    <script type="text/javascript" src="jquery-3.7.1.js"></script>
</head>
<body>
<script>
    $(function () {
        $("#btn1").click(function () {
            $("#div1").css("background-color", "#7be7fa")
            $(".div2").css("background-color", "#76f879")
        })

        $("#btn2").click(function () {
            $("#div1").css("background-color", "#00d1f6")
            $(".div2").css("background-color", "#00f10a")
        })
    })
</script>
<div id="div1">
    <h1>这里是div1</h1>
</div>
<div class="div2">
    <h2>这里是div2</h2>
</div>
<div class="button">
    <button id="btn1">按钮1</button>
    <button id="btn2">按钮2</button>
</div>

</body>
</html>